<%@taglib uri="/WEB-INF/tlds/libreria.tld" prefix="lb"%>
<%@taglib uri="http://displaytag.sf.net" prefix="dt"%>
<!--<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>-->



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<SCRIPT language="JavaScript" src="<%= request.getContextPath() %>/javascript/funcionesgenerales.js"></script>
<SCRIPT language="JavaScript" src="<%= request.getContextPath() %>/javascript/ValidacionesGenerales.js"></script>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Mantenimiento de Usuarios</title>
<script type="text/JavaScript">
<!--



//-->

  function mostrar(nombreCapa){
    document.getElementById(nombreCapa).style.visibility="visible";
  }
  
  function ocultar(nombreCapa){
    document.getElementById(nombreCapa).style.visibility="hidden";
  }

  function f_insertar(){
    mostrar("capa1");
    mostrar("trCodigo");
    document.frm_Manto.txh_Accion.value="I";
    document.frm_Manto.txt_Codigo.focus();
  }


  function f_cancelar(){
    document.frm_Manto.txt_Codigo.value="";
    document.frm_Manto.txt_NroCip.value="";
    document.frm_Manto.txt_Apenom.value="";
    document.frm_Manto.txt_NroSerie.value="";
    document.frm_Manto.txt_GraArm.value="";
    document.frm_Manto.txt_Cargo.value="";
    document.frm_Manto.txt_Clave.value="";
    document.frm_Manto.cbo_CodOrg.value=" ";
    document.frm_Manto.txt_Mail.value="";
    document.frm_Manto.cbo_Estado.value=" ";
    ocultar("capa1");
    ocultar("trCodigo");
  }
  
  var ajaxA=null;
  function funcionCallback2(){
    if( ajaxA.readyState == 4 ){
      if( ajaxA.status == 200 ){
        document.all.cuerpousuario.innerHTML = ajaxA.responseText;	
      }
    }
  }

  function ValidaForm(){

    var Codigo=document.frm_Manto.txt_Codigo.value;
    var Nombre=document.frm_Manto.txt_Nombre.value;
   
    var vval=0;
    if(Nombre==""){
        alert("Ingrese Nombre.. Verificar");
        vval=1;
        document.frm_Manto.txt_Nombre.focus();
      
    }else{
    var Accion=document.frm_Manto.txh_Accion.value;
    if( window.XMLHttpRequest){ajaxA = new XMLHttpRequest(); // No Internet Explorer
    }else{ ajaxA = new ActiveXObject("Microsoft.XMLHTTP");
    } // Internet Explorer
    ajaxA.onreadystatechange = funcionCallback2;
    var ruta=""; var hecho=""; var t_texto="";
    if(Accion=="I"){hecho="I"; t_texto="Insertado";}
    if(Accion=="A"){hecho="A"; t_texto="Actualizado";}
    if(vval==0){
    ruta="<%= request.getContextPath() %>/cineplanet/administracion/frm_cineplanet_lista_usu_ajax.jsp?pasacache=" + new Date().getTime()+"&Codigo="+Codigo+"&Nombre="+Nombre+"&hecho="+hecho;
	ajaxA.open("GET",ruta, true );
	ajaxA.send("");
	//LIMPIANDO TEXTOS 
    document.frm_Manto.txt_Codigo.value="";
    document.frm_Manto.txt_Nombre.value="";
    ocultar("capa1");
    ocultar("trCodigo");
//    alert(t_texto +" con Exito !!!");
    }
  }

  function f_actualizar(Codigo,Nombre){
//    alert(Codigo +" con Codigo !!!");
    mostrar("trCodigo");
    document.frm_Manto.txt_Codigo.value=Codigo;
    document.frm_Manto.txt_Nombre.value=Nombre;
    document.frm_Manto.txh_Accion.value="A";
    mostrar("capa1");
  }

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

</script>
<link href="../../css/estilo_sitpre.css" rel="stylesheet" type="text/css" media="all" />
</head>
<style type="text/css" media="all">
     
      @import url("css/screen.css");
</style>
	
<body onload="MM_preloadImages('<%= request.getContextPath() %>/imagenes/botones/btn_agregar_b.jpg','<%= request.getContextPath() %>/imagenes/botones/btn_eliminar_b.jpg','<%= request.getContextPath() %>/imagenes/botones/btn_nuevo_b.jpg','<%= request.getContextPath() %>/imagenes/botones/btn_grabar_b.gif','<%= request.getContextPath() %>/imagenes/botones/btn_grabar_b.jpg','<%= request.getContextPath() %>/imagenes/botones/btn_cancelar_b.gif','<%= request.getContextPath() %>/imagenes/botones/btn_cancelar_b.jpg','<%= request.getContextPath() %>/imagenes/botones/btn_salir_b.jpg')">
<form name="frm_Manto" method="post" action="">
  <input type="hidden" name="txh_Accion" >
  <input type="hidden" name="txh_CodOrg" >
  <table height="722"  border="0" align="center" cellpadding="0" cellspacing="0">
    <!--DWLayoutTable-->
    <tr>
      <td height="580">&nbsp;</td>
      <td valign="top">
        <table width="700" border="0" cellpadding="0" cellspacing="0" bgcolor="EEEBB6">
          <!--DWLayoutTable-->
          <tr >
            <td height="90" colspan="4"  bgcolor="ECECEC" valign="top"><div align="center"><img src="<%=request.getContextPath() %>/imagenes/fondos/Cabecera_SICOPRI.jpg" width="700" height="80" /></div></td>
          </tr>
          <tr>
            <td width="80" >&nbsp;</td>
            <td width="460" ><!--DWLayoutEmptyCell-->&nbsp;</td>
            <td width="80">&nbsp;</td>
            <td width="80">&nbsp;</td>
          </tr>
          <tr>
            <td height="25" colspan="4"><div align="center"><img src="<%= request.getContextPath() %>/imagenes/titulos/titulo_reg_usuario.png" width="264" height="25" /></div></td>
          </tr>
          <tr>
            <td width="80" height="10">&nbsp;</td>
            <td>&nbsp;</td>
            <td width="80">&nbsp;</td>
            <td width="80"></td>
          </tr>
          <tr>
            <td height="137" colspan="3" rowspan="2" valign="top" >
           <span id="cuerpousuario">
              <dt:table  name="listausuario" requestURI="listaususervlet" pagesize="10" id="usu"  class="isis" style="width:620px"> 
              <dt:column property="VUSU_CODIGO"  title="CODIGO" sortable="true"   >  	</dt:column>
              <dt:column property="VUSU_GRA_ARMA"  title="GRADO" sortable="true" >  </dt:column>
              <dt:column property="VUSU_APE_NOM"  title="APELLIDOS Y NOMBRES" sortable="true" >  </dt:column>
              <dt:column property="VUSU_CARGO"  title="CARGO" sortable="true" >  </dt:column>
              <dt:column property="CUSU_ESTADO"  title="ESTADO" sortable="true" >  </dt:column>
              <dt:column title="ACTUALIZAR">
                <a href="javascript:f_actualizar('<c:out value="${usu.VUSU_CODIGO}"/>',
                  '<c:out value="${usu.CUSU_NRO_CIP}"/>','<c:out value="${usu.VUSU_APE_NOM}"/>');">Actualizar </a></dt:column>
              </dt:table>
           </span>             </td>
            <td width="80" height="30" ><!--DWLayoutEmptyCell-->&nbsp;</td>
          </tr>
          <tr>
            <td width="80" height="112"  valign="top">
              <table>
                <tr>
                  <td><a href="javascript:f_insertar()" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('btn_agregar','','<%= request.getContextPath() %>/imagenes/botones/btn_nuevo_a.png',1)"><img src="<%= request.getContextPath() %>/imagenes/botones/btn_nuevo_b.png" name="btn_agregar" width="72" height="30" border="0" id="btn_agregar" /></a></td>
                </tr>
                <tr>
                  <td><a href="<%= request.getContextPath() %>/sicopri/login/frm_sicopri_menu_principal.jsp" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image10','','<%= request.getContextPath() %>/imagenes/botones/btn_salir_a.png',1)"><img src="<%= request.getContextPath() %>/imagenes/botones/btn_salir_b.png" name="Image10" width="72" height="30" border="0" id="Image10" /></a></td>
                </tr>
              </table>            </td>
          </tr>
          <tr>
            <td height="323" colspan="4"><div align="center" id="capa1" style="width:350;height:250;visibility:hidden" >
              <table border="1" bgcolor="F9F9F2" style="background-position:center" cellpadding="0" cellspacing="0" background="<%= request.getContextPath() %>/imagenes/fondos/PaginaManto.jpg">
                <tr>
                  <td height="136">
                  <table width="524" border="0" align="center">
                    <tr id="trCodigo">
                      <td width="214"><div align="right"><span class="nombre_campo">C&oacute;digo : </span></div></td>
                      <td width="300" ><div align="left">
                        <input name="txt_Codigo" type="text" size="3" maxlength="3"> <!-- readonly="TRUE"-->  
                      </div></td>
                    </tr>
                    <tr>
                      <td><div align="right"><span class="nombre_campo">Nombre : </span></div></td>
                      <td><div align="left">
                        <input name="txt_Nombre" type="text"  onKeyUp="frm_Manto.txt_Nombre.value=frm_Manto.txt_Nombre.value.toUpperCase();"  size="30" maxlength="30">
                      </div></td>
                    </tr>
                  </table>
                  <br />
                  <table border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                      <td><div align="center"><a href="javascript:ValidaForm();" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','<%= request.getContextPath() %>/imagenes/botones/btn_grabar_a.png',1)"><img src="<%= request.getContextPath() %>/imagenes/botones/btn_grabar_b.png" name="Image8" width="72" height="30" border="0" id="Image8" /></a></div></td>
                      <td><div align="center"><a href="javascript:f_cancelar();" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image9','','<%= request.getContextPath() %>/imagenes/botones/btn_cancelar_a.png',1)"><img src="<%= request.getContextPath() %>/imagenes/botones/btn_cancelar_b.png" name="Image9" width="72" height="30" border="0" id="Image9" /></a></div></td>
                    </tr>
                  </table>
                  <p>&nbsp;</p></td>
                </tr>
              </table>
            </div></td>
          </tr>
          <tr>
            <td  colspan="4"><!--DWLayoutEmptyCell-->&nbsp;</td>
          </tr>
          <tr bgcolor="F9F9F2">
            <td colspan="4" bgcolor="FFFFFF"><div align="center"><img src="<%= request.getContextPath() %>/imagenes/fondos/piepagina.jpg" width="700" height="25" /></div></td>
          </tr>
          <tr>
            <td  colspan="4"><!--DWLayoutEmptyCell-->&nbsp;</td>
          </tr>
        </table>
      </td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
</body>
</html>
